let a = "9007199254740991";
let b = "1234567899999999999";

function add(a, b) {
  var maxLength = Math.max(a.length, b.length)
  a = a.padStart(maxLength, 0)
  b = b.padStart(maxLength, 0)
  var t = 0
  var f = 0
  var sum = ''
  for(let i = a.length - 1; i >= 0; i--) {
    t = parseInt(a[i]) + parseInt(b[i]) + f
    f = Math.floor(t / 10)
    sum = t % 10 + sum
    console.log(sum)
  }
  if(f === 1){
    sum = '1' + sum
  }
  return sum
}

console.log(add(a, b))

